import Vue from 'vue';
import lodash from 'lodash';
const getters = {
	siteLogo: (state) => state.common.siteLogo,
	defaultAvatar: (state) => state.common.defaultAvatar,
	token: (state) => {
		return !state.login.token ? Vue.prototype.$session.get('token') : state.login.token;
	},
	siteInfo: (state) => {
		let siteInfo = state.common.siteInfo;
		return lodash.isEmpty(siteInfo) ? Vue.prototype.$local.get('siteInfo') : siteInfo;
	},
	userInfo: (state) => {
		let userInfo = state.login.userInfo;
		return lodash.isEmpty(userInfo) ? Vue.prototype.$local.get('userInfo') : userInfo;
	},
	dictConst: (state) => {
		let dictConst = state.common.dictConst;
		return lodash.isEmpty(dictConst) ? Vue.prototype.$local.get('dictConst') : dictConst;
	},
	dictEnums: (state) => {
		let dictEnums = state.common.dictEnums;
		return lodash.isEmpty(dictEnums) ? Vue.prototype.$local.get('dictEnums') : dictEnums;
	},
	menuData: (state) => {
		let menuData = state.login.menuData;
		return lodash.isEmpty(menuData) ? Vue.prototype.$local.get('menuData') : menuData;
	},
	authButton: (state) => {
		let authButton = state.login.authButton;
		return lodash.isEmpty(authButton) ? Vue.prototype.$local.get('authButton') : authButton;
	},
	departTree: (state) => {
		let departTree = state.depart.departTree;
		return lodash.isEmpty(departTree) ? Vue.prototype.$local.get('departData') : departTree;
	},
	siteConfig: (state) => {
		let siteConfig = state.common.siteConfig;
		return lodash.isEmpty(siteConfig) ? Vue.prototype.$local.get('siteConfig') : siteConfig;
	},
	principalData: (state) => {
		let principalData = state.login.principalData;
		return lodash.isEmpty(principalData) ? Vue.prototype.$local.get('principalData') : principalData;
	},
	sendData: (state) => {
		let sendData = state.login.sendData;
		return lodash.isEmpty(sendData) ? Vue.prototype.$session.get('sendData') : sendData;
	},
	messageCount: (state) => state.business.messageCount
};
export default getters;